package com.moyangfenghun.javabase.model;

import com.mybatisflex.annotation.*;
import lombok.Data;

import java.util.List;

/**
 * 账号 实体类。
 *
 * @author yt
 * @since 0.0.1
 */
@Data
@Table(value = "account")
public class AccountEntity {

    /**
     * id
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 账号名
     */
    @Column(value = "ac_name")
    private String acName;

    /**
     * 角色
     */
    @RelationManyToMany(
            joinTable = "ac_role_mapping", // 中间表
            selfField = "id", joinSelfColumn = "ac_id",
            targetField = "id", joinTargetColumn = "role_id"
    )
    private List<RoleEntity> roles;
}
